#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   text.py
@Time    :   2021/11/29 10:53:43
@Author  :   xulong
@Version :   1.0
@Contact :   784511751@qq.com
@License :   MIT
@Desc    :   None
'''

# here put the import lib
import requests
from lxml import etree
url = 'https://www.imooc.com/course/list'
res = requests.get(url)
# print(res.status_code)
res.encoding = res.apparent_encoding
ehtml = etree.HTML(res.text)
title = ehtml.xpath('//p[@class="title ellipsis2"]/text()')
title1 = ehtml.xpath('//p[@class="one"]/text()')
title2 = ehtml.xpath('//p[@class="two clearfix"]/span/text()')
print(title)
print(title1)
print(title2)


#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   text1.py
@Time    :   2021/11/29 10:53:43
@Author  :   xulong
@Version :   1.0
@Contact :   784511751@qq.com
@License :   MIT
@Desc    :   None
'''

# here put the import lib
import requests
from lxml import etree
url = 'http://www.1ppt.com/moban/'
res = requests.get(url)
# print(res.status_code)
res.encoding = res.apparent_encoding
ehtml = etree.HTML(res.text)
title = ehtml.xpath('//h2/a/text()')
title1 = ehtml.xpath('//ul[@class="tplist"]/li/span/text()[2]')
title2 = ehtml.xpath('//ul[@class="tplist"]/li/a/img/@src')
print(title)
print(title1)
print(title2)

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   text2.py
@Time    :   2021/11/29 10:53:43
@Author  :   xulong
@Version :   1.0
@Contact :   784511751@qq.com
@License :   MIT
@Desc    :   None
'''

# here put the import lib
import requests
from lxml import etree
url = 'https://jh.lianjia.com/ershoufang/'
res = requests.get(url)
res.encoding = res.apparent_encoding
ehtml = etree.HTML(res.text)
title = ehtml.xpath('//div[@class="title"]/a/text()')
title1 = ehtml.xpath('//div[@class="houseInfo"]/text()')
title2 = ehtml.xpath('//div[@class="totalPrice totalPrice2"]/span/text()')
title3 = ehtml.xpath('//div[@class="unitPrice"]/span/text()')
print(title)
print(title1)
print(title2)
print(title3)

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   text2.py
@Time    :   2021/11/29 10:53:43
@Author  :   xulong
@Version :   1.0
@Contact :   784511751@qq.com
@License :   MIT
@Desc    :   None
'''

# here put the import lib
import requests
from lxml import etree
url = 'https://hotel.qunar.com/'
res = requests.get(url)
res.encoding = res.apparent_encoding
ehtml = etree.HTML(res.text)
title = ehtml.xpath('//p[@class="name text-elli-one"]/text()')
title1 = ehtml.xpath('//p[@class="score"]/span/text()')
title2 = ehtml.xpath('//p[@class="comm_num"]/text()')
title3 = ehtml.xpath('//p[@class="price"]/text()')
print(title)
print(title1)
print(title2)
print(title3)


#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   text2.py
@Time    :   2021/11/29 10:53:43
@Author  :   xulong
@Version :   1.0
@Contact :   784511751@qq.com
@License :   MIT
@Desc    :   None
'''

# here put the import lib
import requests
from lxml import etree
url = 'https://china.nba.com/static/data/league/playerstats_All_All_All_0_All_false_2021_2_All_Team_points_All_perGame.json'
res = requests.get(url)
# print(res.text)
res.encoding = res.apparent_encoding
a = res.json()
for i in range(1,50):
    print(a['payload']['players'][i]['playerProfile']['displayName'])
    print(a['payload']['players'][i]['teamProfile']['displayAbbr'])
    print(a['payload']['players'][i]['statAverage']['pointsPg'])